package com.hunttown.mes.rpc.domain.enums.catalog;

import java.util.HashMap;
import java.util.Map;

/**
 * 全站分类 模块类型 枚举
 * created by wangjunfu on 2018/11/6
 */
public enum CatalogTypeEnum {
    CATALOG01(1, "图表类别"),
    CATALOG02(2, "文章类别"),
    CATALOG03(3, "品牌"),
    CATALOG04(4, "司机分组"),
    CATALOG05(5, "车辆品牌"),
    CATALOG06(6, "配件品牌"),
    CATALOG07(7, "行业"),
    CATALOG08(8, "维护项目"),
    CATALOG09(9, "配件车型"),
    CATALOG10(10, "充电桩"),
    CATALOG11(11, "报销类型"),
    CATALOG12(12, "报销项目"),
    CATALOG13(13, "备班类别"),
    CATALOG14(14, "银行"),
    CATALOG15(15, "单位类别"),
    CATALOG16(16, "发票单位"),
    CATALOG17(17, "配件类别"),
    CATALOG18(18, "物料类别"),
    CATALOG19(19, "流程类别"),
    CATALOG20(20, "物料仓库"),
    CATALOG21(21, "物料品牌"),
    CATALOG22(22, "任务类别"),
    CATALOG23(23, "车辆车型"),
    CATALOG24(24, "设备品牌"),
    CATALOG25(25, "勘察线路"),
    CATALOG26(26, "设备品牌"),
    CATALOG27(27, "提醒类别"),
    CATALOG28(28, "工单类型"),
    CATALOG29(29, "故障原因"),
    CATALOG30(30, "物流公司"),
    CATALOG31(31, "设备类型"),
    CATALOG32(32, "故障类型"),
    CATALOG33(33, "封装形式"),
    CATALOG34(34, "缺陷类型"),
    CATALOG35(35, "存储仓库"),
    CATALOG36(36, "内容类别"),
    CATALOG37(37, "运维站点"),
    CATALOG38(38, "证书类型"),
    CATALOG39(39, "团体类别");

    private final int key;
    private final String value;

    CatalogTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (CatalogTypeEnum temp : CatalogTypeEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (CatalogTypeEnum temp : CatalogTypeEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
